<div class="fm-content">
  <!-- 最上面标题栏 -->
  <div class="title">
    <i nz-icon [type]="'desktop'"></i>
    &nbsp;&nbsp;工作日设置
  </div>
  <!-- 内容 -->
  <div class="work">

    <!-- 查询框 -->
    <div class="top">
      <nz-month-picker class="fm-input first-input" [(ngModel)]="selectedDate"
        (ngModelChange)="loadData()" nzPlaceHolder="年月选择"></nz-month-picker>
    </div>

    <!-- 右则样表单主体 -->
    <div class="work-content">
      <div class="table">
        <!--日历 start-->
        <nz-calendar [nzDateCell]="dateCellTpl" (nzSelectChange)="selectChange()" [(ngModel)]="selectedDate">
        </nz-calendar>
        <!-- 传入 TemplateRef 的方式 -->
        <ng-template #dateCellTpl let-date>
          <ng-template ngFor let-data [ngForOf]="fs.datas">
            <div *ngIf="getSpedate(data.spedate,date)" class="events">
              <span style="float:right;">
                <nz-tag (click)="fs.editRow(data)">编辑</nz-tag>
                <nz-tag nz-popconfirm nzTitle="确认删除?" (nzOnConfirm)="fs.delEntity(data)">删除</nz-tag>
              </span><br />
              <nz-badge *ngIf="data.type=='1'" [nzStatus]="'success'" [nzText]="data.typeName"></nz-badge>
              <nz-badge *ngIf="data.type!='1'" [nzStatus]="'warning'" [nzText]="data.typeName"></nz-badge>
              <nz-badge *ngIf="data.bz!='' && data.bz!=null" [nzStatus]="'error'" [nzText]="'备注：'+data.bz"></nz-badge>
              <br />
            </div>
          </ng-template>
        </ng-template>
      </div>
    </div>

    <nz-modal nzWidth='830' nzTitle="编辑" [nzMaskClosable]='false' [nzFooter]="null" 
      [(nzVisible)]="fs.isEditVisible"
      (nzOnCancel)="fs.closeEdit()">
      <form nz-form [nzLayout]="'inline'">
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">日期类型</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="type.invalid?'error':'success'" nzHasFeedback>
                <nz-select [(ngModel)]="fs.er.type" name="type" required #type="ngModel" [nzPlaceHolder]="'请选择'">
                  <nz-option *ngFor="let option of typeDic.datas" [nzLabel]="option.display"
                    [nzValue]="option.id">
                  </nz-option>
                </nz-select>
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">日期</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="spedate.invalid?'error':'success'"
                nzHasFeedback>
                <nz-date-picker [disabled]="true" [(ngModel)]="fs.er.spedate" name="spedate" required
                  #spedate="ngModel"></nz-date-picker>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24">
            <nz-form-item>
              <nz-form-label class="form-label">备注</nz-form-label>
              <nz-form-control class="form-control3">
                <textarea nz-input [(ngModel)]="fs.er.bz" name="bz"></textarea>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24" class="form-button-align">
            <button nz-button nzType="default" (click)="fs.closeEdit()" class="form-button">取消</button>
            <button nz-button nzType="primary" [disabled]='type.invalid || spedate.invalid' (click)="fs.save()"
              [nzLoading]="fs.isSaveing">保存</button>
          </div>
        </div>
      </form>
    </nz-modal>
  </div>
</div>